/**
 * 
 */
package com.digitalart.futbol.hibernate.serviceImpl;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.digitalart.futbol.hibernate.dao.CanchaDao;
import com.digitalart.futbol.hibernate.ejb.Cancha;
import com.digitalart.futbol.hibernate.service.CanchaService;

/**
 * @author Ulises
 *
 */
@Service

public class CanchaServiceImpl implements CanchaService {

	@Autowired(required=true)
	private CanchaDao canchaDao;
	
	@Transactional
	public Cancha createCancha(Cancha cancha){
		Cancha result = (Cancha)this.canchaDao.persistOnMerge(cancha);
		return result;
		
	}
	
	@Transactional
	public Cancha retriveCancha(int id){
		Cancha result = this.canchaDao.findById(id);
		return result;
	}
	
	@Transactional
	public List<Cancha> findByAll(){
		List<Cancha> result = this.canchaDao.findByAll();
		return result;
	}

}
